import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'

Vue.use(VueRouter)

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

// 设置权限路由数组
// const permission = ['/mine', '/cart']

// router.beforeEach((to, from, next) => {
//   if (permission.includes(to.path)) {
//     if (store.state.loginModule.token) {
//       next()
//     } else {
//       next('/login')
//     }
//   } else {
//     next()
//   }
// })

// 定义全局守卫

export default router
